home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Text / Show / Less / less-252 / configure.in < prev    next >
Text File  |  1994-10-15  |  4KB  |  119 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(forwback.c)
  3. AC_CONFIG_HEADER(defines.h)
  4.  
  5. dnl Checks for programs.
  6. AC_PROG_CC
  7. AC_GCC_TRADITIONAL
  8. AC_PROG_INSTALL
  9.  
  10. dnl Checks for libraries.
  11. TERMLIBS=
  12. AC_HAVE_LIBRARY(curses, [TERMLIBS="$TERMLIBS -lcurses"])
  13. AC_HAVE_LIBRARY(termcap, [TERMLIBS="$TERMLIBS -ltermcap"])
  14. AC_HAVE_LIBRARY(termlib, [have_termlib=yes], [have_termlib=no])
  15. dnl Regular expressions (regcmp) are in -lgen on Solaris 2,
  16. dnl and in -lintl on SCO Unix.
  17. AC_HAVE_LIBRARY(gen, [LIBS="$LIBS -lgen"])
  18. AC_HAVE_LIBRARY(intl, [LIBS="$LIBS -lintl"])
  19. dnl ??? AC_HAVE_LIBRARY(gnuregex, [LIBS="$LIBS -lgnuregex"])
  20.  
  21. dnl Solaris has curses & termcap, but they don't work without libucb
  22. dnl which is broken, so we use termlib.
  23. AC_CHECKING(termlib)
  24. SAVE_LIBS=$LIBS
  25. LIBS="$LIBS $TERMLIBS"
  26. AC_COMPILE_CHECK(, , [tgetent(0); tgetflag(0); tgetnum(0); tgetstr(0);],
  27.   [termok=yes], [termok=no])
  28. if test $termok = no; then
  29.   LIBS="$SAVE_LIBS"
  30.   if test $have_termlib = yes; then
  31.     LIBS="$LIBS -ltermlib"
  32.   fi
  33. fi
  34.  
  35. dnl Checks for header files.
  36. AC_STDC_HEADERS
  37. AC_HAVE_HEADERS(ctype.h errno.h fcntl.h stdio.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h)
  38.  
  39. dnl Checks for identifiers.
  40. AC_OFF_T
  41. AC_COMPILE_CHECK(void, , [void *foo = 0;], 
  42.   [AC_DEFINE(HAVE_VOID)])
  43. AC_COMPILE_CHECK(time_t, [#include <time.h>], [time_t t = 0;],
  44.   [AC_DEFINE(HAVE_TIME_T)])
  45.  
  46. dnl Checks for functions and external variables.
  47. AC_RETSIGTYPE
  48. AC_HAVE_FUNCS(_setjmp system sigsetmask memcpy strchr)
  49. dnl Some systems have termios.h but not the corresponding functions.
  50. AC_FUNC_CHECK(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
  51. AC_COMPILE_CHECK(strerror, [
  52. #if HAVE_STDIO_H
  53. #include <stdio.h>
  54. #endif
  55. #if HAVE_STRING_H
  56. #include <string.h>
  57. #endif
  58. #if HAVE_ERRNO_H
  59. #include <errno.h>
  60. #endif], [static char *x; x = strerror(0);],
  61.   [AC_DEFINE(HAVE_STRERROR)])
  62. AC_COMPILE_CHECK(, , [extern int sys_errlist; static int x; x = sys_errlist;], 
  63.   [AC_DEFINE(HAVE_SYS_ERRLIST)])
  64. AC_COMPILE_CHECK(, , [extern int errno; static int x; x = errno;], 
  65.   [AC_DEFINE(HAVE_ERRNO)])
  66. AC_COMPILE_CHECK(locale, [#include <locale.h>
  67. #include <ctype.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);],
  68.   [AC_DEFINE(HAVE_LOCALE)])
  69. AC_COMPILE_CHECK(ctype, [
  70. #if HAVE_CTYPE_H
  71. #include <ctype.h>
  72. #endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);],
  73.   [AC_DEFINE(HAVE_UPPER_LOWER)])
  74.  
  75. have_ospeed=no
  76. AC_CHECKING(termcap for ospeed)
  77. AC_COMPILE_CHECK(, [
  78. #include <sys/types.h>
  79. #if HAVE_TERMIOS_H
  80. #include <termios.h>
  81. #endif
  82. #if HAVE_TERMCAP_H
  83. #include <termcap.h>
  84. #endif], [ospeed = 0;], [AC_DEFINE(HAVE_OSPEED) have_ospeed=yes])
  85. if test $have_ospeed = no; then
  86. AC_COMPILE_CHECK(, , [extern short ospeed; ospeed = 0;], 
  87.   [AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)])
  88. fi
  89.  
  90.  
  91. dnl Checks for regular expression functions.
  92. have_regex=no
  93. AC_CHECKING(for POSIX regex.h)
  94. AC_COMPILE_CHECK(, [#include <sys/types.h>
  95. #include <regex.h>],
  96.   [regex_t *r; regfree(r);],
  97.   AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes)
  98. if test $have_regex = no; then
  99. AC_FUNC_CHECK(regcmp, AC_DEFINE(HAVE_REGCMP) have_regex=yes)
  100. fi
  101. if test $have_regex = no; then
  102. AC_COMPILE_CHECK(, [#include "regexp.h"], [regcomp("");],
  103. AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes)
  104. fi
  105. if test $have_regex = no && test -f ${srcdir}/regex.c; then
  106. AC_DEFINE(HAVE_POSIX_REGCOMP) REGEX_O='regex.$(O)' AC_SUBST(REGEX_O) have_regex=yes
  107. fi
  108. if test $have_regex = no && test -f ${srcdir}/regexp.c; then
  109. AC_DEFINE(HAVE_V8_REGCOMP) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
  110. fi
  111. if test $have_regex = no; then
  112. AC_FUNC_CHECK(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes)
  113. fi
  114. if test $have_regex = no; then
  115. AC_DEFINE(NO_REGEX)
  116. fi
  117.  
  118. AC_OUTPUT(Makefile)
  119.